package com.scholarone.s1exporttool.common;

import org.springframework.util.Assert;

public class DataSourceContextHolder {
 
   private static final ThreadLocal<DataSource> contextHolder =
            new ThreadLocal<DataSource>();
 
	/**
	 * @param dataSourceId
	 */
   public static void setDataSource(DataSource dataSource) {
      Assert.notNull(dataSource, "DataSourceName cannot be null");
      contextHolder.set(dataSource);
   }
 
   public static DataSource getDataSource() {
      return (DataSource) contextHolder.get();
   }
 
   public static void clearDataSource() {
      contextHolder.remove();
   }
}
